/* eslint-disable @typescript-eslint/no-unused-vars */
import axios from 'axios';
import type { AxiosRequestConfig, AxiosResponse } from 'axios';

const $api = axios.create({
  baseURL: 'http://127.0.0.1:3030',
});

$api.interceptors.request.use((config: AxiosRequestConfig) => {
  const actk = window.localStorage.getItem('accessToken');
  // eslint-disable-next-line no-param-reassign
  if (actk) config.headers.Authorization = `bearer ${actk}`;
  return config;
});

export default $api;
